package com.qd.dict.sys;

import com.cdqidi.dict.annotation.FieldBind;
import com.cdqidi.dict.config.IFieldProcess;
import com.qd.common.dict.DictConstant;
import com.qd.system.service.login.LoginUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 机构名字转换
 * @author sjk
 */
@Component
@RequiredArgsConstructor
public class SysLoginUserProcessImpl implements IFieldProcess {
    private final LoginUserService loginUserService;

    @Override
    public String processName() {
        return DictConstant.SYS_LOGIN_USER;
    }

    @Override
    public Object convertValue(FieldBind fieldBind, Object fieldValue) {
        if(null == fieldValue){
            return "";
        }
        return loginUserService.idToDisplay(fieldValue.toString());
    }
}